<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png" />
    <c1 msg="Welcome to Your Vue.js App" />
    <c2 msg="Welcome to Your Vue.js App" />
    <button @click="click()">数据</button>
  </div>
</template>

<script>
import c1 from "@/components/component1.vue";
import c2 from "@/components/component2.vue";
import { getA } from "../api/index.js";
export default {
  name: "Home",
  data() {
    return {
      getA
    };
  },
  components: {
    c1,
    c2
  },
  methods: {
    async click() {
      let data = await getA().catch(err => {
        alert("错误信息：" + err);
      });
      if (data) alert(JSON.stringify(data));
    }
  }
};
</script>
